#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

bool numPalindrome(int num){
    vector<int> v;

    while(num != 0){
        int d = num % 10;
        v.push_back(d);
        num = num / 10;
    }

    for(int l = 0, r = v.size() - 1; l < r; ++l, --r){
        if(v[l] != v[r]){
            return false;
        }
    }
    
    return true;
}

bool numPalindrome1(int num){
    if(num < 0){return false;}

    int left = num / 10;
    int right = num % 10;

    while(left > right){
        right = right * 10 + left % 10;
        left /= 10;
    }

    return (left == right) || (left == right/10);
}

int main(int argc, char const *argv[])
{
    int num = 13455431;
    cout << numPalindrome(num) <<endl;

    return 0;
}
